package Practica4.EBNF;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.Token;

import antlr.ANTLRError;
import antlr.ANTLRException;
import antlr.CommonToken;
import antlr.NoViableAltException;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
		try {
			CharStream input = new ANTLRFileStream(args[0]);
			AnalexMiToken lexer = new AnalexMiToken(input);
			org.antlr.runtime.Token token = lexer.nextToken();
	        while (token.getType()!=Token.EOF) {
	             System.out.println("Token: " + token.getText() + " [fil: " + token.getLine() + " col: " + token.getCharPositionInLine() + "]" + " [file: " + token.toString() + "]");
	             token = lexer.nextToken();
	        }
			
		}catch (IOException e) {
			System.out.println("Error de fichero");
		}
		
    }
}
